package com.bbx.taxi.client.Bean.Attribute;

import java.util.ArrayList;

import android.app.Application;

import com.bbx.api.sdk.model.passanger.Return.CarType.CarType;
import com.bbx.api.sdk.model.passanger.Return.MyOrderList.MyOrderList;
import com.bbx.taxi.client.MyApplication;
import com.bbx.taxi.client.Bean.Value;
import com.bbx.taxi.client.Bean.Attribute.ChangeAttribute.OnContentFillingListener;
import com.bbx.taxi.client.Util.FormatUtil;

/**
 * 主界面的信息临时存储
 */
public class MainAttribute {
	private boolean isNoListener=false;
	/**
	 * 主界面内容填写监听
	 * 
	 */
	public interface OnContentFillingListener {
		/**
		 * 主界面内容填写监听方法
		 */
		public void onContentFilling();
	};

	public OnContentFillingListener mOnContentFillingListener;

	public void setOnContentFillingListener(
			OnContentFillingListener hOnContentFillingListener) {
		mOnContentFillingListener = hOnContentFillingListener;
	}
	public void removeOnContentFillingListener(OnContentFillingListener hOnContentFillingListener){
		mOnContentFillingListener = null;
	}

	public static final int REQUEST_CODE_PERSON = 10;
	public static final int REQUEST_CODE_PERSON2 = 11;
	public static final int REQUEST_CODE_START_ADDRESS = 12;
	public static final int REQUEST_CODE_END_ADDRESS = 13;
	public static final int REQUEST_CODE_PLANE = 14;
	public static final int REQUEST_CODE_MESSAGE = 15;
	public static final int REQUEST_CODE_GOODS = 16;
	public static final int REQUEST_CODE_EDITNAME = 17;
	private String time = Value.now_time;
	private String time_sn = Value.now_time;
	private String st_start_name = "";
	private String sn_start_name = "";
	private String st_start_city = "";
	private String sn_start_city = "";
	private String st_start_address = "";
	private String sn_start_address = "";
	private double st_start_longitude;
	private double sn_start_longitude;
	private double st_start_latitude;
	private double sn_start_latitude;
	private String st_end_name = "";
	private String sn_end_name = "";
	private String st_end_city = "";
	private String sn_end_city = "";
	private String st_end_address = "";
	private String sn_end_address = "";
	private double st_end_longitude;
	private double sn_end_longitude;
	private double st_end_latitude;
	private double sn_end_latitude;
	private String name = "";
	private String tel;
	private String name2 = "";
	private String tel2;
	private String message_kj = "";
	private String message_pc = "";
	private int goods_weight;// 物品重量
	private int goods_volume;// 物品体积
	private int count = 1;
	/**包车数量*/
	private int count_bc = 1;
	/**感谢费*/
	private int thanksfee = 0;
	/** 判断是否是航班，0为不是，1为接机，2个送机 */
	private int plane_status;
	private String plane_numble;
	/**判断是否勾选条款*/
	private boolean  isCBclause=true;
	private int is_mutiple_oncar=0;
	private static MainAttribute main;
	/**判断是否是推荐站点*/
	public boolean isStartRecommend=false;
	public boolean isEndRecommend=false;
	/**在城际约租判断是否是拼车*/
	public boolean isPC=true;
	/**----------------车型-------------------*/
	//车辆类型:1-出租车、2-网约车、3-商务七座、4-商务中巴、5-商务大巴（默认1）
	public int car_type_sn=1,car_type_cj;
	//车辆类型名称:出租车、网约车、商务七座、商务中巴、商务大巴（默认出租车）
	public String car_type_name_sn="出租车",car_type_name_cj="出租车";
	//车辆座位数:5-舒适车/豪华车 7-商务七座 14/20-商务中巴 38/40-商务大巴（默认5）
	public int seat_num_sn,seat_num_cj;
	//车辆级别:1-舒适车、2-豪华车（只适用网约车和商务七座）
	public int car_level_sn,car_level_cj;
	//包车方式:0-单程、1-半日租、2-日租（包车订单用）
	public int business_type_sn,business_type_cj;
	//计价方式:0-打表、1-在线计费
	public int calc_type_sn,calc_type_cj;
	public static MainAttribute getInstance() {
		if (main == null) {
			main = new MainAttribute();
			return main;

		} else
			return main;
	}

	public void setTime(String time,boolean isCity) {
		if(isCity){
			this.time_sn = time;
		}else{
			this.time = time;
		}
		onContentFilling();
	}
    public CjType getCjType(){
    	return citype;
    }
    public enum CjType{
    	PC,BC,SF
    }
    CjType citype=CjType.PC;
    public void setCjType(CjType citype){
    	this.citype=citype;
    }
	public String getTime(boolean isCity) {
		if(isCity){
			return time_sn;
		}else{
			return time;
		}
		
	}

	public void setStartName(String st_start_name) {
		this.st_start_name = st_start_name;
		onContentFilling();
	}
	public void setStartName(String sn_start_name,boolean isCity) {
		if(isCity){
			this.sn_start_name = sn_start_name;
			onContentFilling();	
		}
		else{
			setStartName(sn_start_name);
		}

	}

	public String getStartName() {
		return st_start_name;
	}
	public String getStartName(boolean isCity) {
		if(isCity){
			return sn_start_name;	
		}
		else{
			return getStartName();
		}
		
	}

	public void setStartCity(String st_start_city) {
		this.st_start_city = st_start_city;
	}
	public void setStartCity(String sn_start_city,boolean isCity) {
		if(isCity){
			this.sn_start_city = sn_start_city;
		}
		else{
			setStartCity(sn_start_city);
		}
	
	}
	public String getStartCity() {
		try {
			if (st_start_city == null || st_start_city.equals("")||st_start_city.contains(Value.CITY_SPILT)
					||st_start_city.contains("\t")||st_start_city.contains("-")) {
				if(st_start_name.contains(Value.CITY_SPILT)){
					st_start_city = st_start_name.substring(0,
							st_start_name.indexOf(Value.CITY_SPILT));
				}
				else if(st_start_name.contains("\t")){
					st_start_city = st_start_name.substring(0,
							st_start_name.indexOf("\t"));
				}
				else if(st_start_name.contains("-")){
					st_start_city = st_start_name.substring(0,
							st_start_name.indexOf("-"));
				}
				else{
					st_start_city=st_start_name;
				}

			}
		} catch (Exception e) {
		}

		return st_start_city;
	}
	public String getStartCity(boolean isCity) {
		if(isCity){
			try {
				if (sn_start_city == null || sn_start_city.equals("")||sn_start_city.contains(Value.CITY_SPILT)
						||sn_start_city.contains("\t")||sn_start_city.contains("-")) {
					if(sn_start_name.contains(Value.CITY_SPILT)){
						sn_start_city = sn_start_name.substring(0,
								sn_start_name.indexOf(Value.CITY_SPILT));
					}
					else if(sn_start_name.contains("\t")){
						sn_start_city = sn_start_name.substring(0,
								sn_start_name.indexOf("\t"));
					}
					else if(sn_start_name.contains("-")){
						sn_start_city = sn_start_name.substring(0,
								sn_start_name.indexOf("-"));
					}
					else{
						sn_start_city=sn_start_name;
					}

				}
			} catch (Exception e) {
			}
			
			return sn_start_city;
		}
		else{
			return getStartCity();
		}
	}
	
	public void setStartAddress(String st_start_address) {
		this.st_start_address = st_start_address;
//		onContentFilling();
	}
	public void setStartAddress(String sn_start_address,boolean isCity) {
		if(isCity){
			this.sn_start_address = sn_start_address;
//			onContentFilling();
		}
		else{
			setStartAddress(sn_start_address);
		}
	}

	public String getStartAddress() {
		return (st_start_address!=null&&!st_start_address.equals(""))?st_start_address:st_start_name;
	}
	public String getStartAddress(boolean isCity) {
		if(isCity){
			return sn_start_address;
		}
		else{
			return getStartAddress();
		}

	}
	public void setStartLongitude(double st_start_longitude) {
		this.st_start_longitude = st_start_longitude;
//		onContentFilling();
	}
	public void setStartLongitude(double sn_start_longitude,boolean isCity) {
		if(isCity){
			this.sn_start_longitude = sn_start_longitude;
//			onContentFilling();
		}
		else{
			setStartLongitude(sn_start_longitude);
		}

	}
	public double getStartLongitude() {
		return st_start_longitude;
	}
	public double getStartLongitude(boolean isCity) {
		if(isCity){
			return sn_start_longitude;
		}
		else{
			return getStartLongitude();
		}
		
	}
	public void setStartLatitude(double st_start_latitude) {
		this.st_start_latitude = st_start_latitude;
//		onContentFilling();
	}
	public void setStartLatitude(double sn_start_latitude,boolean isCity) {
		if(isCity){
			this.sn_start_latitude = sn_start_latitude;
//			onContentFilling();
		}
		else{
			setStartLatitude(sn_start_latitude);
		}

	}
	public double getStartLatitude() {
		return st_start_latitude;
	}
	public double getStartLatitude(boolean isCity) {
		if(isCity){
			return sn_start_latitude;
		}
		else{
			return getStartLatitude();
		}
		
	}
	/**判断市内跟城际的出发地经纬度是否相同*/
	public boolean isStartSameLatLng(){
		if(getStartLatitude(true)==getStartLatitude(false)&&getStartLongitude(true)==getStartLongitude(false)){
			return true;
		}
		return false;
	}
	public void setEndName(String st_end_name) {
		this.st_end_name = st_end_name;
		onContentFilling();
	}
	public void setEndName(String sn_end_name,boolean isCity) {
		if(isCity){
			this.sn_end_name = sn_end_name;
			onContentFilling();
		}
		else{
			setEndName(sn_end_name);
		}

	}
	public String getEndName() {
		return st_end_name;
	}
	public String getEndName(boolean isCity) {
		if(isCity){
			return sn_end_name;
		}
		else{
			return getEndName();
		}
		
	}
	public void setEndCity(String st_end_city) {
		this.st_end_city = st_end_city;
	}
	public void setEndCity(String sn_end_city,boolean isCity) {
		if(isCity){
			this.sn_end_city = sn_end_city;
		}
		else{
			setEndCity(sn_end_city);
		}

	}
	public String getEndCity() {
		try {
			if (st_end_city == null || st_end_city.equals("")||st_end_city.contains(Value.CITY_SPILT)
					||st_end_city.contains("\t")||st_end_city.contains("-")) {
				if(st_end_name.contains(Value.CITY_SPILT)){
					st_end_city = st_end_name.substring(0,
							st_end_name.indexOf(Value.CITY_SPILT));
				}
				else if(st_end_name.contains("\t")){
					st_end_city = st_end_name.substring(0,
							st_end_name.indexOf("\t"));
				}
				else if(st_end_name.contains("-")){
					st_end_city = st_end_name.substring(0,
							st_end_name.indexOf("-"));
				}
				else{
					st_end_city=st_end_name;
				}

			}
		} catch (Exception e) {
		}

		return st_end_city;
	}
	public String getEndCity(boolean isCity) {
		if(isCity){
		try {
			if (sn_end_city == null || sn_end_city.equals("")||sn_end_city.contains(Value.CITY_SPILT)
					||sn_end_city.contains("\t")||sn_end_city.contains("-")) {
				if(sn_end_name.contains(Value.CITY_SPILT)){
					sn_end_city = sn_end_name.substring(0,
							sn_end_name.indexOf(Value.CITY_SPILT));
				}
				else if(sn_end_name.contains("\t")){
					sn_end_city = sn_end_name.substring(0,
							sn_end_name.indexOf("\t"));
				}
				else if(sn_end_name.contains("-")){
					sn_end_city = sn_end_name.substring(0,
							sn_end_name.indexOf("-"));
				}
				else{
					sn_end_city=sn_end_name;
				}

			}
		} catch (Exception e) {
		}

		return sn_end_city;
		}
		else{
			return getEndCity();
		}
	}
	public void setEndAddress(String st_end_address) {
		this.st_end_address = st_end_address;
//		onContentFilling();
	}
	public void setEndAddress(String sn_end_address,boolean isCity) {
		if(isCity){
			this.sn_end_address = sn_end_address;
//			onContentFilling();
		}
		else{
			setEndAddress(sn_end_address);	
		}

	}
	public String getEndAddress() {
		return (st_end_address!=null&&!st_end_address.equals(""))?st_end_address:st_end_name;
	}
	public String getEndAddress(boolean isCity) {
		if(isCity){
			return sn_end_address;
		}
		else{
			return getEndAddress();
		}
		
	}
	public void setEndLongitude(double st_end_longitude) {
		this.st_end_longitude = st_end_longitude;
//		onContentFilling();
	}
	public void setEndLongitude(double sn_end_longitude,boolean isCity) {
		if(isCity){
			this.sn_end_longitude = sn_end_longitude;
//			onContentFilling();
		}
		else{
			setEndLongitude(sn_end_longitude);
		}

	}
	public double getEndLongitude() {
		return st_end_longitude;
	}
	public double getEndLongitude(boolean isCity) {
		if(isCity){
			return sn_end_longitude;	
		}
		else{
			return getEndLongitude();	
		}

	}
	public void setEndLatitude(double st_end_latitude) {
		this.st_end_latitude = st_end_latitude;
//		onContentFilling();
	}
	public void setEndLatitude(double sn_end_latitude,boolean isCity) {
		if(isCity){
			this.sn_end_latitude = sn_end_latitude;
//			onContentFilling();
		}else{
			setEndLatitude(sn_end_latitude);
		}

	}
	public double getEndLatitude() {
		return st_end_latitude;
	}
	public double getEndLatitude(boolean isCity) {
		if(isCity){
			return sn_end_latitude;
		}else{
			return getEndLatitude();
		}
	
	}
	public void setName(String name) {
		this.name = name;
		onContentFilling();
	}

	public String getName() {
		return name;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getTel() {
		return tel;
	}

	public void setName2(String name2) {
		this.name2 = name2;
		onContentFilling();
	}

	public String getName2() {
		return name2;
	}

	public void setTel2(String tel2) {
		this.tel2 = tel2;
		onContentFilling();
	}

	public String getTel2() {
		return tel2;
	}

	public void setMessage_KJ(String message) {
		this.message_kj = message;
	}

	public String getMessage_KJ() {
		return message_kj;
	}
	public void setMessage_PC(String message) {
		this.message_pc = message;
	}

	public String getMessage_PC() {
		return message_pc;
	}
	public void setGoodsWeight(int goods_weight) {
		this.goods_weight = goods_weight;
//		onContentFilling();
	}

	public int getGoodsWeight() {
		return goods_weight;
	}

	public void setGoodsVolume(int goods_volume) {
		this.goods_volume = goods_volume;
//		onContentFilling();
	}

	public int getGoodsVolume() {
		return goods_volume;
	}

	public void setCount(int count) {
		this.count = count;
		onContentFilling();
	}

	public int getCount() {
		return count;
	}
	public void setCount_BC(int count_bc) {
		this.count_bc = count_bc;
		onContentFilling();
	}

	public int getCount_BC() {
		return count_bc;
	}
	/**单位元*/
	public void setThanksfee(int thanksfee) {
		this.thanksfee = thanksfee;
	}

	public int getThanksfee() {
		return thanksfee;
	}
	public void setPlaneStatus(int plane_status) {
		this.plane_status = plane_status;
		onContentFilling();
	}

	public int getPlaneStatus() {
		return plane_status;
	}

	public void setPlaneNumble(String plane_numble) {
		this.plane_numble = plane_numble;
		onContentFilling();
	}

	public String getPlaneNumble() {
		return plane_numble;
	}
	public void setIsCBclause(boolean  isCBclause) {
		this.isCBclause = isCBclause;
		onContentFilling();
	}

	public boolean  getIsCBclause() {
		return isCBclause;
	}
	public void setIs_mutiple_oncar(int  is_mutiple_oncar) {
		this.is_mutiple_oncar = is_mutiple_oncar;
	}

	public int getIs_mutiple_oncar() {
		return is_mutiple_oncar;
	}
	
	//下面都是车型相关
	
	/**车辆类型:1-出租车、2-网约车、3-商务七座、4-商务中巴、5-商务大巴（默认1）*/
	public void setCarType(int viewid,int car_type){
		switch(viewid){
		case Value.VIEWID_SN:
			this.car_type_sn=car_type;
			break;
		case Value.VIEWID_PC:
			if(main.getCjType() == CjType.BC)
			this.car_type_cj=car_type;
			break;
		}
		
	}
	/**车辆类型:1-出租车、2-网约车、3-商务七座、4-商务中巴、5-商务大巴（默认1）*/
	public int getCarType(int viewid){
		switch(viewid){
		case Value.VIEWID_SN:
			return car_type_sn;
		case Value.VIEWID_PC:
			if(main.getCjType() == CjType.BC)
			return car_type_cj;
		}
		return 0;
	}
	
	/**车辆类型名称:出租车、网约车、商务七座、商务中巴、商务大巴（默认出租车）*/
	public void setCarTypeName(int viewid,String car_type_name){
		switch(viewid){
		case Value.VIEWID_SN:
			this.car_type_name_sn=car_type_name;
			break;
		case Value.VIEWID_PC:
			if(main.getCjType() == CjType.BC)
			this.car_type_name_cj=car_type_name;
			break;
		}
	}
	/**车辆类型名称:出租车、网约车、商务七座、商务中巴、商务大巴（默认出租车）*/
	public String getCarTypeName(int viewid){
		switch(viewid){
		case Value.VIEWID_SN:
			return car_type_name_sn;
		case Value.VIEWID_PC:
			if(main.getCjType() == CjType.BC)
			return car_type_name_cj;
		}
		return "出租车";
	}
	
	/**车辆座位数:5-舒适车/豪华车 7-商务七座 14/20-商务中巴 38/40-商务大巴*/
	public void setSeatNum(int viewid,int seat_num){
		switch(viewid){
		case Value.VIEWID_SN:
			this.seat_num_sn=seat_num;
			break;
		case Value.VIEWID_PC:
			if(main.getCjType() == CjType.BC)
			this.seat_num_cj=seat_num;
			break;
		}
	}
	/**车辆座位数:5-舒适车/豪华车 7-商务七座 14/20-商务中巴 38/40-商务大巴（默认5）*/
	public int getSeatNum(int viewid){
		switch(viewid){
		case Value.VIEWID_SN:
			return seat_num_sn;
		case Value.VIEWID_PC:
			if(main.getCjType() == CjType.BC)
			return seat_num_cj;
		}
		return 0;
	}
	/**车辆级别:1-舒适车、2-豪华车（只适用网约车和商务七座）*/
	public void setCarLevel(int viewid,int car_level){
		switch(viewid){
		case Value.VIEWID_SN:
			this.car_level_sn=car_level;
			break;
		case Value.VIEWID_PC:
			if(main.getCjType() == CjType.BC)
			this.car_level_cj=car_level;
			break;
		}
		
	}
	/**车辆级别:1-舒适车、2-豪华车（只适用网约车和商务七座））*/
	public int getCarLevel(int viewid){
		switch(viewid){
		case Value.VIEWID_SN:
			return car_level_sn;
		case Value.VIEWID_PC:
			if(main.getCjType() == CjType.BC)
			return car_level_cj;
		}
		return 0;
	}
	/**包车方式:0-单程、1-半日租、2-日租（包车订单用）*/
	public void setBusinessType(int viewid,int business_type){
		switch(viewid){
		case Value.VIEWID_SN:
			this.business_type_sn=business_type;
			break;
		case Value.VIEWID_PC:
			if(main.getCjType() == CjType.BC)
			this.business_type_cj=business_type;
			break;
		}
		
	}
	/**包车方式:0-单程、1-半日租、2-日租（包车订单用）*/
	public int getBusinessType(int viewid){
		switch(viewid){
		case Value.VIEWID_SN:
			return business_type_sn;
		case Value.VIEWID_PC:
			if(main.getCjType() == CjType.BC)
			return business_type_cj;
		}
		return 0;
	}
	
	/**计价方式:0-打表、1-在线计费*/
	public void setCalcType(int viewid,int calc_type){
		switch(viewid){
		case Value.VIEWID_SN:
			this.calc_type_sn=calc_type;
			break;
		case Value.VIEWID_PC:
			if(main.getCjType() == CjType.BC)
				this.calc_type_cj=calc_type;
			break;
		}
		
	}
	/**计价方式:0-打表、1-在线计费*/
	public int getCalcType(int viewid){
		switch(viewid){
		case Value.VIEWID_SN:
			return calc_type_sn;
		case Value.VIEWID_PC:
			if(main.getCjType() == CjType.BC)
			return calc_type_cj;
		}
		return CarType.CALC_TYPE_dabiao;
	}
	/**
	 * 交换起始位置
	 */
	public void onSwap() {
		StringBuffer[] sb_name = new StringBuffer[2];
		sb_name[0] = new StringBuffer(st_start_name + "");
		sb_name[1] = new StringBuffer(st_end_name + "");
		st_start_name = sb_name[1].toString();
		st_end_name = sb_name[0].toString();

		StringBuffer[] sb_city = new StringBuffer[2];
		sb_city[0] = new StringBuffer(st_start_city + "");
		sb_city[1] = new StringBuffer(st_end_city + "");
		st_start_city = sb_city[1].toString();
		st_end_city = sb_city[0].toString();

		StringBuffer[] sb_address = new StringBuffer[2];
		sb_address[0] = new StringBuffer(st_start_address + "");
		sb_address[1] = new StringBuffer(st_end_address + "");
		st_start_address = sb_address[1].toString();
		st_end_address = sb_address[0].toString();

		StringBuffer[] sb_longitude = new StringBuffer[2];
		sb_longitude[0] = new StringBuffer(st_start_longitude + "");
		sb_longitude[1] = new StringBuffer(st_end_longitude + "");
		st_start_longitude = Double.parseDouble(sb_longitude[1].toString());
		st_end_longitude = Double.parseDouble(sb_longitude[0].toString());

		StringBuffer[] sb_latitude = new StringBuffer[2];
		sb_latitude[0] = new StringBuffer(st_start_latitude + "");
		sb_latitude[1] = new StringBuffer(st_end_latitude + "");
		st_start_latitude = Double.parseDouble(sb_latitude[1].toString());
		st_end_latitude = Double.parseDouble(sb_latitude[0].toString());
		
		boolean isRecommend=isStartRecommend;
		isStartRecommend=isEndRecommend;
		isEndRecommend=isRecommend;
		onContentFilling();
	}
	/**
	 * 交换起始位置
	 */
	public void onSwap(boolean isCity) {
		if(isCity){
		StringBuffer[] sb_name = new StringBuffer[2];
		sb_name[0] = new StringBuffer(sn_start_name + "");
		sb_name[1] = new StringBuffer(sn_end_name + "");
		sn_start_name = sb_name[1].toString();
		sn_end_name = sb_name[0].toString();

		StringBuffer[] sb_city = new StringBuffer[2];
		sb_city[0] = new StringBuffer(sn_start_city + "");
		sb_city[1] = new StringBuffer(sn_end_city + "");
		sn_start_city = sb_city[1].toString();
		sn_end_city = sb_city[0].toString();

		StringBuffer[] sb_address = new StringBuffer[2];
		sb_address[0] = new StringBuffer(sn_start_address + "");
		sb_address[1] = new StringBuffer(sn_end_address + "");
		sn_start_address = sb_address[1].toString();
		sn_end_address = sb_address[0].toString();

		StringBuffer[] sb_longitude = new StringBuffer[2];
		sb_longitude[0] = new StringBuffer(sn_start_longitude + "");
		sb_longitude[1] = new StringBuffer(sn_end_longitude + "");
		sn_start_longitude = Double.parseDouble(sb_longitude[1].toString());
		sn_end_longitude = Double.parseDouble(sb_longitude[0].toString());

		StringBuffer[] sb_latitude = new StringBuffer[2];
		sb_latitude[0] = new StringBuffer(sn_start_latitude + "");
		sb_latitude[1] = new StringBuffer(sn_end_latitude + "");
		sn_start_latitude = Double.parseDouble(sb_latitude[1].toString());
		sn_end_latitude = Double.parseDouble(sb_latitude[0].toString());
		onContentFilling();
		}
		else{
			onSwap();
		}
	}
	/**
	 * 设置所有的属性
	 */
	public void setAttribute(MyOrderList mMyOrderList) {
		isNoListener=true;

		main.setThanksfee(0);
		switch(mMyOrderList.getOrder_type()){
		case Value.ORDER_TYPE_SN:
			main.setCount(1);
			main.setMessage_KJ("");
			main.setMessage_PC("");
			main.setCount_BC(1);
			break;
		case Value.ORDER_TYPE_KJ:
			main.setCount(mMyOrderList.getLocations().getCount());
			main.setMessage_KJ(mMyOrderList.getMessage());
			main.setMessage_PC("");
			main.setCount_BC(1);
			break;
		case Value.ORDER_TYPE_PC:
			main.setCount(mMyOrderList.getLocations().getCount());
			main.setMessage_KJ("");
			main.setMessage_PC(mMyOrderList.getMessage());
			main.setCount_BC(1);
			setCjType(CjType.PC);
			break;
		case Value.ORDER_TYPE_BC:
			main.setCount(1);
			main.setCount_BC(mMyOrderList.getLocations().getCount());
			main.setMessage_KJ("");
			setCjType(CjType.BC);
			main.setMessage_PC(mMyOrderList.getMessage());
			main.setIs_mutiple_oncar(mMyOrderList.getLocations().getIs_mutiple_oncar());
			break;
		}	
		switch(mMyOrderList.getOrder_origin()){
		    case Value.ORDER_ORIGIN:break;
		    case Value.ORDER_ORIGIN_SF:
		    	main.setCount(mMyOrderList.getLocations().getCount());
			    main.setMessage_KJ("");
			    main.setMessage_PC(mMyOrderList.getMessage());
			    main.setCount_BC(1);
			    setCjType(CjType.SF);
		    	break;
		}
		main.setTime(Value.now_time,false);
		main.setTime(Value.now_time,true);
		boolean isCity=(mMyOrderList.getOrder_type()==Value.ORDER_TYPE_SN)?true:false;
		main.setStartName(mMyOrderList.getLocations().getStart().getAddress(),isCity);
		main.setStartAddress("");//设置地址为空
		main.setStartCity("",isCity);
		main.setStartLatitude(mMyOrderList.getLocations().getStart()
				.getLocation().getLat(),isCity);
		main.setStartLongitude(mMyOrderList.getLocations().getStart()
				.getLocation().getLng(),isCity);
		main.setEndName(mMyOrderList.getLocations().getEnd().getAddress(),isCity);
		main.setEndAddress("");//设置地址为空
		main.setEndCity("",isCity);
		main.setEndLatitude(mMyOrderList.getLocations().getEnd().getLocation()
				.getLat(),isCity);
		main.setEndLongitude(mMyOrderList.getLocations().getEnd().getLocation()
				.getLng(),isCity);
		main.setTel(mMyOrderList.getLocations().getStart().getPhone());
		main.setTel2(mMyOrderList.getLocations().getEnd().getPhone());
		main.setName(mMyOrderList.getLocations().getStart().getName());
		main.setName2(mMyOrderList.getLocations().getEnd().getName());
		try {
			main.setGoodsVolume(Integer.parseInt(mMyOrderList.getLocations()
					.getVolume()));
			main.setGoodsWeight(Integer.parseInt(mMyOrderList.getLocations()
					.getWeight()));
		} catch (Exception e) {
		}
		isStartRecommend=false;
		isEndRecommend=false;
		isNoListener=false;

	}
    /**还原目的地*/
	public void onRestoreEnd(){
		isNoListener=true;
		isEndRecommend=false;
		main.setEndName("",true);
		main.setEndName("",false);
		main.setEndCity("",true);
		main.setEndCity("",false);
		main.setEndAddress("");
		main.setEndLatitude(0,true);
		main.setEndLatitude(0,false);
		main.setEndLongitude(0,true);
		main.setEndLongitude(0,false);
		isNoListener=false;
    }
	public void onRestoreStart(){
		isNoListener=true;
		isStartRecommend=false;
		main.setStartName("",true);
		main.setStartName("",false);
		main.setStartCity("",true);
		main.setStartCity("",false);
		main.setStartAddress("");
		main.setStartLatitude(0,true);
		main.setStartLatitude(0,false);
		main.setStartLongitude(0,true);
		main.setStartLongitude(0,false);
		isNoListener=false;
	}
	/**
	 * 还原属性值
	 */
	public void onRestoreAttribute() {
		isNoListener=true;
		MyApplication mApplication = MyApplication.getInstance();
		isStartRecommend=false;
		isEndRecommend=false;
		main.setStartName("",true);
		main.setStartName("",false);
		main.setStartCity("",true);
		main.setStartCity("",false);
		main.setStartAddress("");
		main.setStartLatitude(0,true);
		main.setStartLatitude(0,false);
		main.setStartLongitude(0,true);
		main.setStartLongitude(0,false);
		main.setEndName("",true);
		main.setEndName("",false);
		main.setEndCity("",true);
		main.setEndCity("",false);
		main.setEndAddress("");
		main.setEndLatitude(0,true);
		main.setEndLatitude(0,false);
		main.setEndLongitude(0,true);
		main.setEndLongitude(0,false);
		main.setTel(mApplication.user_phone);
		main.setTel2("");
		main.setName(mApplication.user_name);
		main.setName2("");
		main.setCount(1);
		main.setCount_BC(1);
		main.setGoodsVolume(0);
		main.setGoodsWeight(0);
		main.setMessage_KJ(null);
		main.setMessage_PC(null);
		main.setTime(Value.now_time,false);
		main.setTime(Value.now_time,true);
		main.setThanksfee(0);
		isNoListener=false;
	}

	/**
	 * 调用内容填充监听方法，用来监听必选的内容是否全部填满
	 */
	public void onContentFilling() {
		if (mOnContentFillingListener != null&&!isNoListener) {
//			mOnContentFillingListener.onContentFilling();
		}
	}
	/**
	 * 市内信息带到城际信息
	 */
	public void onSnToCJ(){
		main.st_start_city=(main.getStartCity(true));
		main.st_end_city=(main.getEndCity(true));
		main.st_start_address=(main.getStartAddress(true));
		main.st_end_address=(main.getEndAddress(true));
		main.st_start_name=(main.getStartName(true));
		main.st_end_name=(main.getEndName(true));
		main.st_start_latitude=(main.getStartLatitude(true));
		main.st_end_latitude=(main.getEndLatitude(true));
		main.st_start_longitude=(main.getStartLongitude(true));
		main.st_end_longitude=(main.getEndLongitude(true));
		main.time=main.getTime(true);
	}
	/**
	 * 城际信息带到市内信息
	 */
	public void onCjToSn(){
		main.sn_start_city=(main.getStartCity());
		main.sn_end_city=(main.getEndCity());
		main.sn_start_address=(main.getStartAddress());
		main.sn_end_address=(main.getEndAddress());
		main.sn_start_name=(main.getStartName());
		main.sn_end_name=(main.getEndName());
		main.sn_start_latitude=(main.getStartLatitude());
		main.sn_end_latitude=(main.getEndLatitude());
		main.sn_start_longitude=(main.getStartLongitude());
		main.sn_end_longitude=(main.getEndLongitude());
		main.time_sn=Value.now_time;
	}
}
